<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page import="java.util.*,java.text.*,java.sql.*,javax.sql.*"%>
<html>
	<head>
		<title>登录验证</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>

	<body>
		<%
			String name = "lfr";
			String password = "lfr";
			String driver = "oracle.jdbc.driver.OracleDriver";
			String url = "jdbc:oracle:thin:@127.0.0.1:1521:jssbook";
			Class.forName(driver);
			Connection conn = DriverManager.getConnection(url, name, password);
			String sql = "select * from usersinfo";
			PreparedStatement prestmt = conn.prepareStatement(sql);
			ResultSet rs = prestmt.executeQuery();
			
			request.setCharacterEncoding("utf-8");
			while (rs.next()) {

				String user_name = rs.getString("user_name");
				String user_password = rs.getString("user_password");

				if (user_name.equals(request.getParameter("user_name"))
						&& user_password.equals(request
								.getParameter("user_password"))) {
					request.getRequestDispatcher("/homepage.jsp").forward(
							request, response);
					break;

				}

			}
		%>



	</body>
</html>
